package org.dyz.banana.vo;

public class JsonResponse {

    public static final String RESPONSE_CODE_SUCCESS = "200";
    public static final String RESPONSE_CODE_FAIL = "500";

    private String code;
    private String msg;
    private String result;

    public static JsonResponse success(){
        JsonResponse response = new JsonResponse();
        response.setCode(RESPONSE_CODE_SUCCESS);
        response.setMsg("成功！");
        return response;
    }

    public static JsonResponse success(String msg){
        JsonResponse response = new JsonResponse();
        response.setCode(RESPONSE_CODE_SUCCESS);
        response.setMsg(msg);
        return response;
    }

    public static JsonResponse success(String msg,String result){
        JsonResponse response = new JsonResponse();
        response.setCode(RESPONSE_CODE_SUCCESS);
        response.setMsg(msg);
        response.setResult(result);
        return response;
    }

    public static JsonResponse fail(){
        JsonResponse response = new JsonResponse();
        response.setCode(RESPONSE_CODE_FAIL);
        response.setMsg("成功！");
        return response;
    }

    public static JsonResponse fail(String msg){
        JsonResponse response = new JsonResponse();
        response.setCode(RESPONSE_CODE_FAIL);
        response.setMsg(msg);
        return response;
    }

    public static JsonResponse fail(String msg,String result){
        JsonResponse response = new JsonResponse();
        response.setCode(RESPONSE_CODE_FAIL);
        response.setMsg(msg);
        response.setResult(result);
        return response;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }
}
